package com.wits.qso.service;

import java.util.HashMap;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Component;

import com.wits.platform.common.utils.PageUtil;
import com.wits.platform.service.BaseService;
import com.wits.platform.web.mvc.PageParam;
import com.wits.qso.dao.CourseDao;
import com.wits.qso.dao.CourseTeacherViewDao;
import com.wits.qso.dao.StudentDao;
import com.wits.qso.dao.TeacherDao;
import com.wits.qso.entity.CourseTeacherView;

/**
 * 课程老师显示对象，选择课程时使用
 */
@Component
public class CourseTeacherViewService extends
		BaseService<CourseTeacherView, String> {

	/**
	 * 课程数据库操作类
	 */
	@Resource
	private CourseDao courseDao;
	/**
	 * 老师数据库操作类
	 */
	@Resource
	private TeacherDao teacherDao;

	/**
	 * 学生数据库操作类
	 */
	@Resource
	private StudentDao studentDao;

	/**
	 * 课程老师数据库操作类
	 */
	private CourseTeacherViewDao courseTeacherViewDao;

	@Resource
	public void setCourseTeacherViewDao(
			CourseTeacherViewDao courseTeacherViewDao) {
		this.baseDao = courseTeacherViewDao;
		this.courseTeacherViewDao = courseTeacherViewDao;
	}

	public CourseTeacherViewDao getCourseTeacherViewDao() {
		return courseTeacherViewDao;
	}

	public Page<CourseTeacherView> findCourseTeacherViewPage(Map<String, Object> filterParams,PageParam page){
		Map<String,Object> param=new HashMap<String,Object>();
		param.putAll(filterParams);
		param.put("orderByArray", new String[]{"course_id"});
		param.put("pageNumber", page.getPageNum()); 
		param.put("pageSize", page.getNumPerPage());
		
		return courseTeacherViewDao.findCourseTeacherViewPage(param);
	}
}
